home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 24 / Mac Magazin and MacEasy Magazine CD - Issue 24.iso / Grafik & Text / Microsoft Installer Patch / main.c < prev    next >
C/C++ Source or Header  |  1996-07-13  |  841b  |  54 lines

  1. #include <A4Stuff.h>
  2. #include "patches.h"
  3. #include "notify.h"
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12. // this is really ugly... 
  13. #define CAPS_KEY_IS_DOWN (*(Byte*)(0x17b)&2)
  14.  
  15.  
  16. // globals
  17. Str63    volumeName;
  18. short    volumeVRef;
  19.  
  20.  
  21. void main(void)
  22. {
  23.     Handle            me;
  24.     StringHandle    notifyString;
  25.     
  26.     EnterCodeResource();
  27.  
  28.     // abort condition
  29.     if ( CAPS_KEY_IS_DOWN ) goto done;
  30.     
  31.     // get the name of the startup volume, which should be our default volume
  32.     GetVol( volumeName, &volumeVRef );
  33.     
  34.     // detach ourselves, because our helper routine will be getting called
  35.     me = Get1Resource( 'INIT', 128 );
  36.     if (!me) goto done;
  37.     
  38.     // make sure we're locked up tight
  39.     DetachResource(me);
  40.     HLock(me);
  41.     HNoPurge(me);
  42.  
  43.     PatchFSDispatch();
  44.     
  45.     // inform the user that we're installed
  46.     notifyString = GetString( 128 );
  47.     if (notifyString) UserNotify( *notifyString );
  48.  
  49. done:
  50.     ExitCodeResource();
  51. }
  52.  
  53.  
  54.